package com.zhuoyue.biz.core.api.dto.rep;

import com.zhuoyue.biz.core.api.domain.RoomDO;
import com.zhuoyue.biz.core.api.domain.room.GetRoomAndDeviceCountDO;
import lombok.Data;

/**
 * @author wjming
 * @ClassName: RoomRepDTO
 * @Description: 回应给前端的房间DTO
 * @Date 2021-07-02 10:48
 */
@Data
public class RoomRepDTO extends BaseRepDTO {
    private String homeId;

    private String name;


    private String imgUrl;

    private Integer deviceCount;

    public RoomRepDTO getRoomAndDeviceCountDoToRoomDto(GetRoomAndDeviceCountDO roomAndDeviceCountDO) {
        setId(roomAndDeviceCountDO.getId());
        setCreateTime(roomAndDeviceCountDO.getCreateTime());
        this.homeId = roomAndDeviceCountDO.getHomeId();
        this.name = roomAndDeviceCountDO.getName();
        this.imgUrl = roomAndDeviceCountDO.getImgUrl();
        this.deviceCount = roomAndDeviceCountDO.getDeviceCount();
        return this;
    }

    public RoomRepDTO roomDoToRoomDto(RoomDO room) {
        setId(room.getId());
        setCreateTime(room.getCreateTime());
        this.homeId = room.getHomeId();
        this.name = room.getName();
        this.imgUrl = room.getImgUrl();
        this.deviceCount = 0;
        return this;
    }
}
